package com.woniuxy.joylifecenter.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class CenterConfig implements WebMvcConfigurer {
    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        configurer.setUseSuffixPatternMatch(false);
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**")

                .addResourceLocations("classpath:/static/")
                .addResourceLocations("classpath:/public/")
                .addResourceLocations("classpath:/resources/");

    }

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/index").setViewName("index.html");
        registry.addViewController("/login").setViewName("/login-1.html");

        registry.addViewController("/page/user-manage.html").setViewName("/page/user-manage.html");
        registry.addViewController("/page/userapply-manage.html").setViewName("/page/userapply-manage.html");
        registry.addViewController("/page/forumapply-manage.html").setViewName("/page/forumapply-manage.html");
        registry.addViewController("/page/fibwords-manage.html").setViewName("/page/fibwords-manage.html");
        registry.addViewController("/page/table/add-fibwords.html").setViewName("/page/table/add-fibwords.html");
        registry.addViewController("/page/table/edit-fibwords.html").setViewName("/page/table/edit-fibwords.html");
        registry.addViewController("/page/table/edit-auth.html").setViewName("/page/table/edit-auth.html");
        registry.addViewController("/page/table/add-auth.html").setViewName("/page/table/add-auth.html");
        registry.addViewController("/page/auth-manage.html").setViewName("/page/auth-manage.html");
        registry.addViewController("/page/table/edit-role.html").setViewName("/page/table/edit-role.html");
        registry.addViewController("/page/table/add-role.html").setViewName("/page/table/add-role.html");
        registry.addViewController("/page/role-manage.html").setViewName("/page/role-manage.html");
        registry.addViewController("/page/table/edit-forum.html").setViewName("/page/table/edit-forum.html");
        registry.addViewController("/page/log.html").setViewName("/page/log.html");
        registry.addViewController("/error/404.html").setViewName("/error/404.html");
        registry.addViewController("/page/area.html").setViewName("/page/area.html");
        registry.addViewController("/page/button.html").setViewName("/page/button.html");
        registry.addViewController("/page/color-select.html").setViewName("/page/color-select.html");
        registry.addViewController("/page/editor.html").setViewName("/page/editor.html");
        registry.addViewController("/page/form.html").setViewName("/page/form.html");
        registry.addViewController("/page/forum-init.html").setViewName("/page/forum-init.html");
        registry.addViewController("/page/forum-search.html").setViewName("/page/forum-search.html");
        registry.addViewController("/page/icon.html").setViewName("/page/icon.html");
        registry.addViewController("/page/icon-picker.html").setViewName("/page/icon-picker.html");
        registry.addViewController("/page/layer.html").setViewName("/page/layer.html");
        registry.addViewController("/page/menu.html").setViewName("/page/menu.html");
        registry.addViewController("/page/setting.html").setViewName("/page/setting.html");
        registry.addViewController("/page/table/table.html").setViewName("/page/table/table.html");
        registry.addViewController("/page/table/table-select.html").setViewName("/page/table/table-select.html");
        registry.addViewController("/page/upload.html").setViewName("/page/upload.html");
        registry.addViewController("/page/user-password.html").setViewName("/page/user-password.html");
        registry.addViewController("/page/user-setting.html").setViewName("/page/user-setting.html");
        registry.addViewController("/page/welcome-1.html").setViewName("/page/welcome-1.html");
        registry.addViewController("/page/welcome-2.html").setViewName("/page/welcome-2.html");
        registry.addViewController("/page/welcome-3.html").setViewName("/page/welcome-3.html");
        registry.addViewController("/page/table/add.html").setViewName("/page/table/add.html");
        registry.addViewController("/page/table/edit.html").setViewName("/page/table/edit.html");

    }
}
